package com.weme.mine.activity

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.alibaba.android.arouter.facade.annotation.Route
import com.gyf.immersionbar.BarHide
import com.gyf.immersionbar.ImmersionBar
import com.weme.common.arouter.ARouterHelper
import com.weme.common.arouter.ARouterPaths
import com.weme.common.base.BaseMvvmActivity
import com.weme.common.base.BaseViewModel
import com.weme.common.util.UserMKHelper
import com.weme.mine.databinding.ActivityFollwingBinding
import com.weme.mine.fragment.FansFragment
import com.weme.mine.fragment.FollwingFragment
@Route(path = ARouterPaths.MINE_FOLLWING_ACTIVITY)
class FollwingActivity :BaseMvvmActivity<ActivityFollwingBinding,BaseViewModel>(){
    override fun initView(savedInstanceState: Bundle?) {
        ImmersionBar.with(this).hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR).titleBar(mBinding.customTopNavigationBar).init()
        val fragments = listOf(FollwingFragment(),FansFragment())
        val labels = listOf(getString(com.example.resources.R.string.follwing),getString(com.example.resources.R.string.follwers))
        mBinding.customTopNavigationBar.setTitle(UserMKHelper.decodeString(UserMKHelper.NAME)+","+UserMKHelper.decodeString(UserMKHelper.AGE))

        mBinding.viewPager.adapter = object : FragmentStateAdapter(this) {
            override fun getItemCount(): Int {
                return fragments.size
            }

            override fun createFragment(p0: Int): Fragment {
                return fragments[p0]
            }
        }

        mBinding.indicator.attachViewPager(mBinding.viewPager, labels)
        mBinding.viewPager.setCurrentItem(intent.extras?.getInt(ARouterHelper.KEY_FOLLWING_INDEX, 0)?:0,false)
    }

    override fun getViewModelClass(): Class<BaseViewModel>  = BaseViewModel::class.java

    
}